package com.aspose.cells;

import java.util.ArrayList;

class zaqx {
   private zapt a;
   private Workbook b;
   private zcfx c;

   zaqx(zapt var1) {
      this.a = var1;
      this.b = var1.a;
   }

   void a(ArrayList var1, com.aspose.cells.a.f.zj var2) throws Exception {
      this.c = zarj.a("settings.xml", var2);
      zaqj var3 = new zaqj("text/xml", "settings.xml");
      com.aspose.cells.b.a.a.ze.a(var1, (Object)var3);
      this.c.c();
      this.c.b("office:document-settings");
      this.c.a("xmlns", "office", (String)null, "urn:oasis:names:tc:opendocument:xmlns:office:1.0");
      this.c.a("xmlns", "xlink", (String)null, "http://www.w3.org/1999/xlink");
      this.c.a("xmlns", "config", (String)null, "urn:oasis:names:tc:opendocument:xmlns:config:1.0");
      this.c.a("xmlns", "ooo", (String)null, "http://openoffice.org/2004/office");
      this.c.a("office", "version", (String)null, this.a.m);
      this.c.b("office:settings");
      this.a();
      this.c.b();
      this.c.b();
      this.c.d();
      this.c.e();
   }

   void a() throws Exception {
      this.c.b("config:config-item-set");
      this.c.a("config", "name", (String)null, "ooo:view-settings");
      this.b();
      this.c.b();
   }

   void b() throws Exception {
      this.c.b("config:config-item-map-indexed");
      this.c.a("config", "name", (String)null, "Views");
      this.c();
      this.c.b();
   }

   void c() throws Exception {
      this.c.b("config:config-item-map-entry");
      this.a("ViewId", "string", "View1");
      this.d();
      Worksheet var1 = this.b.getWorksheets().get(this.b.getWorksheets().getActiveSheetIndex());
      this.a("ActiveTable", "string", var1.getName());
      this.a("ShowPageBreakPreview", "boolean", var1.isPageBreakPreview() ? "true" : "false");
      this.a("ShowZeroValues", "boolean", var1.getDisplayZeros() ? "true" : "false");
      this.a("HasColumnRowHeaders", "boolean", var1.isRowColumnHeadersVisible() ? "true" : "false");
      this.a("ShowGrid", "boolean", var1.isGridlinesVisible() ? "true" : "false");
      if (var1.w().isEmpty()) {
         this.a("GridColor", "long", "12632256");
      } else {
         this.a("GridColor", "long", zaqh.a(var1.w().toArgb() & 16777215));
      }

      this.a("HasSheetTabs", "boolean", this.b.getSettings().getShowTabs() ? "true" : "false");
      this.a("HorizontalScrollbarWidth", "int", zaqh.a(this.b.getSettings().getSheetTabBarWidth()));
      if (var1.isPageBreakPreview()) {
         this.a("ShowPageBreaks", "boolean", "true");
         this.a("ZoomValue", "int", zaqh.a(var1.getZoom()));
         this.a("PageViewZoomValue", "int", zaqh.a(var1.getZoom()));
      }

      if (!var1.isOutlineShown()) {
         this.a("IsOutlineSymbolsSet", "boolean", "false");
      }

      this.c.b();
   }

   void d() throws Exception {
      this.c.b("config:config-item-map-named");
      this.c.a("config", "name", (String)null, "Tables");

      for(int var1 = 0; var1 < this.b.getWorksheets().getCount(); ++var1) {
         this.a(this.b.getWorksheets().get(var1));
      }

      this.c.b();
   }

   void a(Worksheet var1) throws Exception {
      this.c.b("config:config-item-map-entry");
      this.c.a("config", "name", (String)null, var1.getName());
      String var2 = var1.getActiveCell();
      byte var4;
      if (!"A1".equals(var2)) {
         byte var3 = 0;
         var4 = 0;
         int[] var5 = new int[]{var3};
         int[] var6 = new int[]{var4};
         CellsHelper.a(var2, var5, var6);
         int var7 = var5[0];
         int var9 = var6[0];
         this.a("CursorPositionX", "int", zaqh.a(var9));
         this.a("CursorPositionY", "int", zaqh.a(var7));
      }

      PaneCollection var8 = var1.getPanes();
      if (var8 != null) {
         var4 = 1;
         if (var1.h()) {
            var4 = 2;
         }

         if (var8.d() == 0) {
            this.a("HorizontalSplitMode", "short", zaqh.a((short)var4));
            this.a("VerticalSplitMode", "short", "0");
            if (var1.h()) {
               this.a("HorizontalSplitPosition", "int", zaqh.a(var8.c()));
            } else {
               this.a("HorizontalSplitPosition", "int", zaqh.a((int)((double)((float)(var8.e() * 4) / 60.0F) + 0.5D)));
            }

            this.a("VerticalSplitPosition", "int", "0");
            switch(var8.a()) {
            case 1:
               this.a("ActiveSplitRange", "short", "3");
               break;
            case 3:
               this.a("ActiveSplitRange", "short", "2");
            }
         } else if (var8.e() == 0) {
            this.a("HorizontalSplitMode", "short", "0");
            this.a("VerticalSplitMode", "short", zaqh.a((short)var4));
            this.a("HorizontalSplitPosition", "int", "0");
            if (var1.h()) {
               this.a("VerticalSplitPosition", "int", zaqh.a(var8.b()));
            } else {
               this.a("VerticalSplitPosition", "int", zaqh.a((int)((double)((float)(var8.d() * 4) / 60.0F) + 0.5D)));
            }

            switch(var8.a()) {
            case 2:
               this.a("ActiveSplitRange", "short", "2");
               break;
            case 3:
               this.a("ActiveSplitRange", "short", "0");
            }
         } else {
            this.a("HorizontalSplitMode", "short", zaqh.a((short)var4));
            this.a("VerticalSplitMode", "short", zaqh.a((short)var4));
            if (var1.h()) {
               this.a("HorizontalSplitPosition", "int", zaqh.a(var8.c()));
               this.a("VerticalSplitPosition", "int", zaqh.a(var8.b()));
            } else {
               this.a("HorizontalSplitPosition", "int", zaqh.a((int)((double)((float)(var8.e() * 4) / 60.0F) + 0.5D)));
               this.a("VerticalSplitPosition", "int", zaqh.a((int)((double)((float)(var8.d() * 4) / 60.0F) + 0.5D)));
            }

            switch(var8.a()) {
            case 0:
               this.a("ActiveSplitRange", "short", "3");
               break;
            case 1:
               this.a("ActiveSplitRange", "short", "1");
               break;
            case 2:
               this.a("ActiveSplitRange", "short", "2");
               break;
            case 3:
               this.a("ActiveSplitRange", "short", "0");
            }
         }

         this.a("PositionLeft", "int", zaqh.a(var1.getFirstVisibleColumn()));
         this.a("PositionTop", "int", zaqh.a(var1.getFirstVisibleRow()));
         if (var1.h()) {
            this.a("PositionRight", "int", zaqh.a(var1.getFirstVisibleColumn() + var8.e()));
            this.a("PositionBottom", "int", zaqh.a(var1.getFirstVisibleRow() + var8.d()));
         } else {
            this.a("PositionRight", "int", zaqh.a(var8.c()));
            this.a("PositionBottom", "int", zaqh.a(var8.b()));
         }
      } else {
         this.a("PositionLeft", "int", zaqh.a(var1.getFirstVisibleColumn()));
         this.a("PositionTop", "int", "0");
         this.a("PositionRight", "int", "0");
         this.a("PositionBottom", "int", zaqh.a(var1.getFirstVisibleRow()));
      }

      this.a("ZoomType", "short", "0");
      this.a("ZoomValue", "int", zaqh.a(var1.getZoom()));
      this.a("PageViewZoomValue", "int", zaqh.a(var1.getZoom()));
      this.a("PageViewZoomValue", "boolean", var1.isGridlinesVisible() ? "1" : "0");
      this.c.b();
   }

   void a(String var1, String var2, String var3) throws Exception {
      this.c.b("config:config-item");
      this.c.a("config", "name", (String)null, var1);
      this.c.a("config", "type", (String)null, var2);
      this.c.a(var3);
      this.c.b();
   }
}
